package com.tt.common.Const;

/**
 * @author 青青
 */
public class TtConstans
{
    public final static String http = "http://";
    public final static String https = "https://";

    /**
     * 分隔符
     */
    public final static String Separator = ":";

    /** 空字符串 */
    public static final String NULLSTR = "";


    /** 下划线 */
    public static final char SEPARATOR = '_';

    /**
     * 斜杆
     */
    public final static String xg = "/";

    /**
     * 连接符
     */
    public final static String Connect_x = "-";

    /**
     * 登录之后存Redis的Key前缀
     */
    public final static String sessionName = "UserSession";

    /**
     * token 名称
     */
    public final static String TT_TOKEN = "TT_TOKEN";

    /**
     * 文件访问前缀
     */
    public final static String filePrefix = "/tt";

    /**
     * 成功
     */
    public final static Integer success = 0;

    /**
     * 根据参数生成Redis的key
     * @param keyName
     * @return
     */
    public static String gen( String ... keyName )
    {
        StringBuffer buffer = new StringBuffer();
        buffer.append(sessionName);
        buffer.append(Separator);
        for (String key : keyName)
        {
            buffer.append(key);
        }
        return buffer.toString();
    }

    public static String genUserToken(String token)
    {
        StringBuffer buffer = new StringBuffer();
        buffer.append(sessionName);
        buffer.append(token);
        return buffer.toString();
    }

}
